package com.heima.test03;

public class Test {
    public static void main(String[] args) {
        //定义存储3个商品对象
        Goods g1 = new Goods(1, "化为手坤", 4999, 66);
        Goods g2 = new Goods(2, "水杯", 99, 56);
        Goods g3 = new Goods(3, "鼠标", 999, 116);
        Goods[] arr = new Goods[3];

//        arr[0] = g1;
//        arr[1] = g2;
//        arr[2] = g3;
        //遍历
        for (int i = 0; i < arr.length; i++) {
            Goods goods = arr[i];
            System.out.println("编号为：" + goods.getId() + " 商品名：" + goods.getName() + " 价格为：" + goods.getPrice() + " 库存为：" + goods.getCount());
        }
    }
}
